<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qquickhandlerpoint.cpp -->
  <title>HandlerPoint QML 类型 | Qt Quick 5.12.3</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.12</a></td><td ><a href="qtquick-index.html">Qt Quick 模块</a></td><td ><a href="qtquick-qmlmodule.html">QML类型</a></td><td >HandlerPoint QML 类型</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtquick-index.html">Qt 5.12.3 参考指南</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">目录</a></h3>
<ul>
<li class="level1"><a href="#properties">属性</a></li>
<li class="level1"><a href="#details">详细信息</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">HandlerPoint QML 类型</h1>
<span class="subtitle"></span>
<!-- $$$HandlerPoint-brief -->
<p>An event point. <a href="#details">更多...</a></p>
<!-- @@@HandlerPoint -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> 导入语句：</td><td class="memItemRight bottomAlign"> import QtQuick 2.12</td></tr></table></div><ul>
<li><a href="qml-qtquick-handlerpoint-members.html">所有成员的列表，包括继承成员</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">属性</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-handlerpoint.html#ellipseDiameters-prop">ellipseDiameters</a></b></b> : size</li>
<li class="fn"><b><b><a href="qml-qtquick-handlerpoint.html#id-prop">id</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-handlerpoint.html#modifiers-prop">modifiers</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-handlerpoint.html#position-prop">position</a></b></b> : QPointF</li>
<li class="fn"><b><b><a href="qml-qtquick-handlerpoint.html#pressPosition-prop">pressPosition</a></b></b> : QPointF</li>
<li class="fn"><b><b><a href="qml-qtquick-handlerpoint.html#pressedButtons-prop">pressedButtons</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-handlerpoint.html#pressure-prop">pressure</a></b></b> : qreal</li>
<li class="fn"><b><b><a href="qml-qtquick-handlerpoint.html#rotation-prop">rotation</a></b></b> : qreal</li>
<li class="fn"><b><b><a href="qml-qtquick-handlerpoint.html#sceneGrabPosition-prop">sceneGrabPosition</a></b></b> : QPointF</li>
<li class="fn"><b><b><a href="qml-qtquick-handlerpoint.html#scenePosition-prop">scenePosition</a></b></b> : QPointF</li>
<li class="fn"><b><b><a href="qml-qtquick-handlerpoint.html#scenePressPosition-prop">scenePressPosition</a></b></b> : QPointF</li>
<li class="fn"><b><b><a href="qml-qtquick-handlerpoint.html#uniqueId-prop">uniqueId</a></b></b> : PointingDeviceUniqueId</li>
<li class="fn"><b><b><a href="qml-qtquick-handlerpoint.html#velocity-prop">velocity</a></b></b> : QVector2D</li>
</ul>
<!-- $$$HandlerPoint-description -->
<a name="details"></a>
<h2 id="details">详细信息</h2>
<p>A QML representation of a QQuickEventPoint.</p>
<p>It's possible to make bindings to properties of a <a href="qml-qtquick-singlepointhandler.html">SinglePointHandler</a>'s current point. For example:</p>
<pre class="qml">

  import QtQuick 2.12

  <span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
      <span class="name">width</span>: <span class="number">640</span>
      <span class="name">height</span>: <span class="number">480</span>

      <span class="type"><a href="qml-qtquick-draghandler.html">DragHandler</a></span> {
          <span class="name">id</span>: <span class="name">handler</span>
          <span class="name">target</span>: <span class="number">null</span>
      }

      <span class="type"><a href="qml-qtquick-text.html">Text</a></span> {
          <span class="name">color</span>: <span class="name">handler</span>.<span class="name">active</span> ? <span class="string">&quot;darkgreen&quot;</span> : <span class="string">&quot;black&quot;</span>
          <span class="name">text</span>: <span class="name">handler</span>.<span class="name">centroid</span>.<span class="name">centroid</span>.<span class="name">x</span>.<span class="name">toFixed</span>(<span class="number">1</span>) <span class="operator">+</span> <span class="string">&quot;,&quot;</span> <span class="operator">+</span> <span class="name">handler</span>.<span class="name">centroid</span>.<span class="name">position</span>.<span class="name">y</span>.<span class="name">toFixed</span>(<span class="number">1</span>)
          <span class="name">x</span>: <span class="name">handler</span>.<span class="name">centroid</span>.<span class="name">position</span>.<span class="name">x</span> <span class="operator">-</span> <span class="name">width</span> <span class="operator">/</span> <span class="number">2</span>
          <span class="name">y</span>: <span class="name">handler</span>.<span class="name">centroid</span>.<span class="name">position</span>.<span class="name">y</span> <span class="operator">-</span> <span class="name">height</span>
      }
  }

</pre>
<p>The point is kept up-to-date when the <a href="qml-qtquick-draghandler.html">DragHandler</a> is actively responding to an <a href="qml-qtquick-eventpoint.html">EventPoint</a>; but when the point is released, or the current point is being handled by a different handler, <code>position.x</code> and <code>position.y</code> are 0.</p>
<p><b>Note: </b>This is practically identical to <a href="qml-qtquick-eventpoint.html">QtQuick::EventPoint</a>; however an <a href="qml-qtquick-eventpoint.html">EventPoint</a> is a long-lived <a href="../qtcore/qobject.html">QObject</a> which is invalidated between gestures and reused for subsequent event deliveries. Continuous bindings to its properties are not possible, and an individual handler cannot rely on it outside the period when that point is part of an active gesture which that handler is handling. <a href="qml-qtquick-handlerpoint.html">HandlerPoint</a> is a <a href="../qtcore/qobject.html#Q_GADGET">Q_GADGET</a> that the handler owns. This allows you to make lifetime bindings to its properties.</p><p><b>See also </b><a href="qml-qtquick-singlepointhandler.html#point-prop">SinglePointHandler::point</a>.</p>
<!-- @@@HandlerPoint -->
<h2>属性文档</h2>
<!-- $$$ellipseDiameters -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="ellipseDiameters-prop">
<td class="tblQmlPropNode"><p>
<a name="ellipseDiameters-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">ellipseDiameters</span> : <span class="type"><a href="../qtqml/qml-size.html">size</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the diameters of the contact patch, if the event comes from a touchpoint and the device provides this information.</p>
<p>A touchpoint is modeled as an elliptical area where the finger is pressed against the touchscreen. (In fact, it could also be modeled as a bitmap; but in that case we expect an elliptical bounding estimate to be fitted to the contact patch before the event is sent.) The harder the user presses, the larger the contact patch; so, these diameters provide an alternate way of detecting pressure, in case the device does not include a separate pressure sensor. The ellipse is centered on <a href="qml-qtquick-handlerpoint.html#scenePosition-prop">scenePosition</a> (<a href="qml-qtquick-handlerpoint.html#position-prop">position</a> in the <a href="qml-qtquick-pointerhandler.html">PointerHandler</a>'s Item's local coordinates). The <a href="qml-qtquick-handlerpoint.html#rotation-prop">rotation</a> property provides the rotation of the ellipse, if known. It is expected that if the <a href="qml-qtquick-handlerpoint.html#rotation-prop">rotation</a> is zero, the <a href="../qtcore/qsize.html#height">height</a> is the larger dimension (the major axis), because of the usual hand position, reaching upward or outward across the surface.</p>
<p>If the contact patch is unknown, or the device is not a touchscreen, these values will be zero.</p>
<p><b>请参考</b> <a href="qml-qtquick-eventtouchpoint.html#ellipseDiameters-prop">QtQuick::EventTouchPoint::ellipseDiameters</a>，<a href="qml-qtquick-touchpoint.html#ellipseDiameters-prop">QtQuick::TouchPoint::ellipseDiameters</a> 和 <a href="../qtgui/qtouchevent-touchpoint.html#ellipseDiameters">QTouchEvent::TouchPoint::ellipseDiameters</a>。</p>
</div></div><!-- @@@ellipseDiameters -->
<br/>
<!-- $$$id -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="id-prop">
<td class="tblQmlPropNode"><p>
<a name="id-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">id</span> : <span class="type"><a href="../qtqml/qml-int.html">int</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The ID number of the point</p>
<p>During a touch gesture, from the time that the first finger is pressed until the last finger is released, each touchpoint will have a unique ID number. Likewise, if input from multiple devices occurs (for example simultaneous mouse and touch presses), all the current event points from all the devices will have unique IDs.</p>
<p><b>Note: </b>Do not assume that id numbers start at zero or that they are sequential. Such an assumption is often false due to the way the underlying drivers work.</p><p><b>See also </b><a href="../qtgui/qtouchevent-touchpoint.html#id">QTouchEvent::TouchPoint::id</a>.</p>
</div></div><!-- @@@id -->
<br/>
<!-- $$$modifiers -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="modifiers-prop">
<td class="tblQmlPropNode"><p>
<a name="modifiers-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">modifiers</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Which modifier keys are currently pressed</p>
<p>This property holds the keyboard modifiers that were pressed at the time the event occurred.</p>
</div></div><!-- @@@modifiers -->
<br/>
<!-- $$$position -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="position-prop">
<td class="tblQmlPropNode"><p>
<a name="position-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">position</span> : <span class="type">QPointF</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The position within the <code>parent</code> Item</p>
<p>This is the position of the event point relative to the bounds of the <a href="qml-qtquick-pointerhandler.html#parent-prop">parent</a>.</p>
</div></div><!-- @@@position -->
<br/>
<!-- $$$pressPosition -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="pressPosition-prop">
<td class="tblQmlPropNode"><p>
<a name="pressPosition-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">pressPosition</span> : <span class="type">QPointF</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The pressed position within the <code>parent</code> Item</p>
<p>This is the position at which this point was pressed, relative to the bounds of the <a href="qml-qtquick-pointerhandler.html#parent-prop">parent</a>.</p>
</div></div><!-- @@@pressPosition -->
<br/>
<!-- $$$pressedButtons -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="pressedButtons-prop">
<td class="tblQmlPropNode"><p>
<a name="pressedButtons-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">pressedButtons</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Which mouse or stylus buttons are currently pressed</p>
<p><b>请参考 </b><a href="qml-qtquick-mousearea.html#pressedButtons-prop">MouseArea::pressedButtons</a>。</p>
</div></div><!-- @@@pressedButtons -->
<br/>
<!-- $$$pressure -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="pressure-prop">
<td class="tblQmlPropNode"><p>
<a name="pressure-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">pressure</span> : <span class="type">qreal</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property tells how hard the user is pressing the stylus on a graphics tablet or the finger against a touchscreen, in the range from <code>0</code> (no measurable pressure) to <code>1.0</code> (maximum pressure which the device can measure).</p>
<p>It is valid only with certain tablets and touchscreens that can measure pressure. Otherwise, it will be zero.</p>
</div></div><!-- @@@pressure -->
<br/>
<!-- $$$rotation -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="rotation-prop">
<td class="tblQmlPropNode"><p>
<a name="rotation-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">rotation</span> : <span class="type">qreal</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the rotation angle of the stylus on a graphics tablet or the contact patch of a touchpoint on a touchscreen.</p>
<p>It is valid only with certain tablet stylus devices and touchscreens that can measure the rotation angle. Otherwise, it will be zero.</p>
</div></div><!-- @@@rotation -->
<br/>
<!-- $$$sceneGrabPosition -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="sceneGrabPosition-prop">
<td class="tblQmlPropNode"><p>
<a name="sceneGrabPosition-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">sceneGrabPosition</span> : <span class="type">QPointF</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The grabbed position within the scene</p>
<p>If this point has been grabbed by a Pointer Handler or an Item, it means that object has taken sole responsibility for handling the movement and the release if this point. In that case, this is the position at which the grab occurred, in the coordinate system of the <a href="qtquick-visualcanvas-scenegraph.html">scene graph</a>.</p>
</div></div><!-- @@@sceneGrabPosition -->
<br/>
<!-- $$$scenePosition -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="scenePosition-prop">
<td class="tblQmlPropNode"><p>
<a name="scenePosition-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">scenePosition</span> : <span class="type">QPointF</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The position within the scene</p>
<p>This is the position of the event point relative to the bounds of the Qt Quick scene (typically the whole window).</p>
</div></div><!-- @@@scenePosition -->
<br/>
<!-- $$$scenePressPosition -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="scenePressPosition-prop">
<td class="tblQmlPropNode"><p>
<a name="scenePressPosition-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">scenePressPosition</span> : <span class="type">QPointF</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The pressed position within the scene</p>
<p>This is the position at which this point was pressed, in the coordinate system of the <a href="qtquick-visualcanvas-scenegraph.html">scene graph</a>.</p>
</div></div><!-- @@@scenePressPosition -->
<br/>
<!-- $$$uniqueId -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="uniqueId-prop">
<td class="tblQmlPropNode"><p>
<a name="uniqueId-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">uniqueId</span> : <span class="type">PointingDeviceUniqueId</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The unique ID of the point, if any</p>
<p>This is normally empty, because touchscreens cannot uniquely identify fingers.</p>
<p>On some types of touchscreens, especially those using TUIO drivers, it's possible to use recognizable physical tokens (fiducial objects) in addition to fingers. So if this point is a touch point, and uniqueId is set, it is the identifier for such an object.</p>
<p>On a graphics tablet, each type of stylus or other tool often has a unique ID or serial number, which can be useful to respond in different ways to different tools.</p>
<p>Interpreting the contents of this ID requires knowledge of the hardware and drivers in use.</p>
<p><b>请参考</b> <a href="../qtgui/qtabletevent.html#uniqueId">QTabletEvent::uniqueId</a>，<a href="qml-qtquick-touchpoint.html#uniqueId-prop">QtQuick::TouchPoint::uniqueId</a> 和 <a href="qml-qtquick-eventtouchpoint.html#uniqueId-prop">QtQuick::EventTouchPoint::uniqueId</a>。</p>
</div></div><!-- @@@uniqueId -->
<br/>
<!-- $$$velocity -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="velocity-prop">
<td class="tblQmlPropNode"><p>
<a name="velocity-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">velocity</span> : <span class="type">QVector2D</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>A vector representing the average speed and direction of movement</p>
<p>This is a velocity vector pointing in the direction of movement, in logical pixels per second. It has x and y components, at least one of which will be nonzero when this point is in motion. It holds the average recent velocity: how fast and in which direction the event point has been moving recently.</p>
<p><b>请参考</b> <a href="qml-qtquick-eventpoint.html#velocity-prop">QtQuick::EventPoint::velocity</a>，<a href="qml-qtquick-touchpoint.html#velocity-prop">QtQuick::TouchPoint::velocity</a> 和 <a href="../qtgui/qtouchevent-touchpoint.html#velocity">QTouchEvent::TouchPoint::velocity</a>。</p>
</div></div><!-- @@@velocity -->
<br/>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
